package com.yykj.hospital.server.converter;

import com.yykj.hospital.client.dto.HospitalDepartmentDTO;
import com.yykj.hospital.server.model.entity.HospitalDepartment;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.stream.Collectors;

public class HospitalDepartmentDTOConverter {
    public static HospitalDepartmentDTO convert(HospitalDepartment item){
        HospitalDepartmentDTO dto = new HospitalDepartmentDTO();
        BeanUtils.copyProperties(item,dto);
        return dto;
    }
    public static  List<HospitalDepartmentDTO> convert(List<HospitalDepartment> list){
        return list.stream().map(HospitalDepartmentDTOConverter::convert).collect(Collectors.toList());
    }

}
